<?php if (!defined("_ECRIRE_INC_VERSION")) return;
/**
 * Aloha Cart
 *
 * @author     Aleksey Yaroshchuk (aleksey.yaroshchuk@gmail.com)
 * @license    GNU/GPL
 * @package    plugins
 * @subpackage alohacart
 * @copyright  (c) Aleksey Yaroshchuk 2011-2012
 * @link       http://www.spip-contrib.net/AlohaCart
 */
 
/**
 *  Dymanic Tag wich outputs total price of products in the Cart
 *  Format: #ALOHACART_CART_PRICE
 */
 
function balise_ALOHACART_CART_PRICE($p) {
	return calculer_balise_dynamique($p,'ALOHACART_CART_PRICE', array());
}

function balise_ALOHACART_CART_PRICE_stat($args, $filtres) {    
	return $args;
}

function balise_ALOHACART_CART_PRICE_dyn($currency_code = false) {
    include_spip('functions/pdk_common');
    $cart = pdk_load_class('Alohacart','classes');
    $price = $cart->CountPrice($currency_code);

    if(strstr($price,'.')!==FALSE) { // if $price is double
        $price = number_format($price,2,'.',''); // make two digits after point
    }
    return array('balise/alohacart_cart_price', 0, 
		array(
            'price'=> $price
		));
}

?>